import React from "react";
import ReactDOM from "react-dom";
import { BrowserRouter as Router, Route, Redirect } from "react-router-dom";
import "./styles/index.less";
import Index from "./pages/index";
import store from "./redux/store";
// import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";\
import { Provider } from "react-redux";
import { RouterList } from "./router/index";
import * as serviceWorker from "./serviceWorker";

  // console.log(store.getState().breadList,'log-store')
ReactDOM.render(
  
  <Provider store={store}>
    <Router>
      {/* <Route path="/login/" exact component={Login}></Route> */}
      {/* <Route path="/" render={() => (
        <Redirect to='/index/' />
      )} /> */}

      <Index />

      {RouterList.map(res => {
        return (
          <Route
            key={res.path}
            path={res.path}
            render={routerProps => {
              return <res.component />;
              // return <routerProps.component {...routerProps}/>
            }}
          />
        );
      })}
      {/* <Redirect to={RouterList[0].path} from="/" /> */}
    </Router>
  </Provider>,
  document.getElementById("root")
);

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
